function(check_lib lib ret)
   find_library("has${lib}" ${lib})
   if(has${lib})
       message("${lib} has been install in ${has${lib}}")
       set(${ret} TRUE PARENT_SCOPE)
   else()
       message("${lib} has not install in ${has${lib}}")
       set(${ret} FALSE PARENT_SCOPE)
   endif()
endfunction()

set(lib-repo-git "git@gitlab.zte.com.cn:10124328/lib-repo.git")
set(lib-repo "${CMAKE_SOURCE_DIR}/lib-repo")

macro(set_local_lib_path path)
   include_directories(${path}/usr/local/include )
   set(CMAKE_LIBRARY_PATH  ${path}/usr/local/lib) 
   set(target_path ${path})
endmacro()

function(check_libs libs path)
   foreach(var ${ARGV})
       check_lib(${var} ${var}_ret)
       if(NOT ${var}_ret)
           if(NOT EXISTS "${lib-repo}")
              execute_process(COMMAND git clone ${lib-repo-git} ${lib-repo})
           endif()
           include("${lib-repo}/${var}/install.cmake")
       endif()
   endforeach()
endfunction()

